package com.techprimers.mybatis.springbootmybatis.resource;

import com.techprimers.mybatis.springbootmybatis.mapper.ThemeMapper;
import com.techprimers.mybatis.springbootmybatis.model.Theme;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
@RequestMapping("/rest/themes")
public class ThemeResource {

    private ThemeMapper themeMapper;

    public ThemeResource(ThemeMapper themeMapper) {
        this.themeMapper = themeMapper;
    }

    @GetMapping("/all")
    public List<Theme> getAll() {
        return themeMapper.findAll();
    }
}
